﻿using Ninject;
using Ninject.Web.Common;
using Systematize.Data.EntityFramework;
using Systematize.Data.EntityFramework.Context;
using Systematize.Domain.Data;
using Systematize.Domain.Services;

namespace Systematize.Ninject
{
    public static class Bindings
    {
        public static void AddBindings(this IKernel kernel)
        {
            // DbContext
            kernel.Bind<IDbContext, IDbContextAsync>().To<SystematizeDbContext>().InRequestScope();

            // Repositories
            kernel.Bind(typeof(IRepository<>)).To(typeof(Repository<>)).InRequestScope();
            kernel.Bind(typeof(IRepositoryAsync<>)).To(typeof(RepositoryAsync<>)).InRequestScope();

            // Services
            kernel.Bind(typeof(ILibraryItemService<>)).To(typeof(LibraryItemService<>)).InRequestScope();
            kernel.Bind(typeof(ILibraryItemServiceAsync<>)).To(typeof(LibraryItemServiceAsync<>)).InRequestScope();
        }
    }
}
